<div class="column-content-box" style="margin:0;">
  <div class="content-box content-box-header ui-corner-all">
    <div class="ui-state-default ui-corner-top ui-box-header">
      <span class="ui-icon float-left ui-icon-notice"></span>
      <?php echo Yii::t('DadminModule.msg', 'fields_required') ?>
    </div>

    <div class="content-box-wrapper">
    <?php 
      $form=$this->beginWidget('CActiveForm', array(
        'id' => 'newsletter-type-form',
        'enableAjaxValidation'=>false,
        'focus' => array($model, 'title'),
        'errorMessageCssClass' => 'error',
        'htmlOptions' => array(
          'class' => 'form',
        ),
      ));
    ?>
    <fieldset>
    <ul>
      <li>
        <?php echo $form->labelEx($model,'parent_id', array('class' => 'desc')); ?>
        <div>
        <?php
          $data = DNewsletterType::model()->getMenu('', false);

          //parent menu
          if (isset($data['0']['1'])) unset($data['0']['1']);
          if (isset($data['0']['4'])) unset($data['0']['4']);
          $this->widget('ArrayToDropDownList', array(
            'model' => $model,
            'attribute' => 'parent_id',
            'data' => $data,
            'selected' => $model->parent_id,
            'disableItem' => $model->id,
            'htmlOptions' => array(
              'style' => 'float: left; width: 150px;'
            )
          ));
          
          //activated_flag
          echo $form->checkbox($model, 'activated_flag', array(
            'class' => 'checkbox',
            'style' => 'float:left; margin: 8px 5px 0 5px;',
          ));
          echo CHtml::label($model->getAttributeLabel('activated_flag'),
            'DNewsletterType_activated_flag', array(
              'class' => 'desc',
              'style' => 'display: inline-block; margin-top:7px;'
          ));
        ?>
        </div>
      </li>

      <li>
        <?php echo $form->labelEx($model,'title', array('class'=>'desc')); ?>
        <div>
        <?php 
          echo $form->textField($model, 'title', array(
            'class' => 'text full',
          ));
          echo $form->error($model,'title');
        ?>
        </div>
      </li>
      
      <li style="text-align: center;">
      <?php
      $label = Yii::t('DadminModule.app', 'save');
      echo CHtml::submitButton($label, array(
          'class' => 'ui-state-default ui-corner-all ui-button'
      ));

      $label = Yii::t('DadminModule.app', 'reset');
      echo CHtml::button($label, array(
          'id'    => 'btn-reset',
          'class' => 'ui-state-default ui-corner-all ui-button',
          'style' => 'margin:0 10px;',
      ));

      $label = Yii::t('DadminModule.app', 'cancel');
      echo CHtml::button($label, array(
          'id'    => 'btn-cancel',
          'class' => 'ui-state-default ui-corner-all ui-button'
      ));
      ?>
      </li>
    <?php $this->endWidget(); ?>
    </div>
  </div>
</div>

<script type="text/javascript">
$('#btn-cancel').click(function(){
  parent.$('#dialogForm').dialog('close');
});

$('#btn-reset').click(function(){
  window.location.href = window.location.href;
});
</script>